package org.xgj.zhangben;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;


import org.apache.commons.beanutils.ConvertUtils;

/**
 * 启动之后的监听器
 * 
 * @author xgj
 * 
 */
public class StartupListener implements ServletContextListener {
	public void contextDestroyed(ServletContextEvent arg0) {
	}

	public void contextInitialized(ServletContextEvent event) {
		registerDataConvert();
	}

	/**
	 * 注册日期转换
	 */
	private void registerDataConvert() {
		try {
			ConvertUtils.register(new DateConverter(), java.util.Date.class);
			ConvertUtils.register(new DateConverter(), java.sql.Date.class);
			ConvertUtils.register(new DoubleConvert(), java.lang.Double.class);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
